﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;

namespace ZXthex.EditorUI
{
    public class EUIWindow : EditorWindow
    {
        private EditorCanvas _canvas;
        protected EditorCanvas canvas
        {
            get
            {
                if (_canvas == null)
                    _canvas = new EditorCanvas(this);
                return _canvas;
            }
        }


        Stack<int> deepIndices = new Stack<int>(7);
        private void OnGUI()
        {
            for (int i = 0; i < canvas.childCount; i++)
            {
                var child = canvas.GetChild(i);
                EUIHelper.TravlesalTransform(child,
                    (c) => c.parent,
                    (c) => c.childCount,
                    (c, ind) => c.GetChlid(ind),
                    (c) => !c.activeSelf,
                    Push);
            }

        }

        void Push(EditorRectTransform ui)
        {
            ui.SelfGUI();
        }
    }
}